package com.qtummatrix.service.impl;

import com.qtummatrix.dao.ProductDao;
import com.qtummatrix.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * create by Gongshiyong  2019-12-07 11:31
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductDao productDao;


    public List<Map<String, Object>> getProductList(int bankid,String loanName,int seriesid,int state,int pageNo,int pageSize) {
        List<Map<String, Object>> productList = productDao.getProductList(bankid,loanName,seriesid,state,pageNo,pageSize);
        return productList;
    }

    public Integer getProductSize(int bankid,String loanName,int seriesid,int state) {
        Integer size = productDao.getProductSize(bankid,loanName,seriesid,state);
        return size;
    }

    public List<Map<String, Object>> getAllproductBankName() {
        List<Map<String, Object>> allproductBankName = productDao.getAllproductBankName();
        return allproductBankName;
    }

    public List<Map<String, Object>> getAllproductSerie() {
        List<Map<String, Object>> allproductSerie = productDao.getAllproductSerie();
        return allproductSerie;
    }

    public List<Map<String, Object>> getAllproductState() {
        List<Map<String, Object>> allproductState = productDao.getAllproductState();
        return allproductState;
    }

    public int deleteProduct(int id) {
        int count = productDao.deleteProduct(id);
        return count;
    }

    public int updateProductState(int id, int state) {
        int count = productDao.updateProductState(id,state);
        return count;
    }

    public List<Map<String, Object>> queryProductList(int productBank, String productName, int productSerie, int productState) {
        List<Map<String, Object>> queryProductList = productDao.queryProductList(productBank,productName,productSerie,productState);
        return queryProductList;
    }

    public int addProduct(int bankid, String loanName, int seriesid, String definition, String customer, BigDecimal benefitsDown, BigDecimal benefitsUp, Integer shortestperiod, Integer longestperiod, BigDecimal rateDown, BigDecimal rateUp, String logo) {
        int count = productDao.addProduct(bankid,loanName,seriesid,definition,customer,benefitsDown,benefitsUp,shortestperiod,longestperiod,rateDown,rateUp,logo);
        return count;
    }

    public List<Map<String, Object>> getProductinfo(int id) {
        List<Map<String, Object>> list = productDao.getProductinfo(id);
        return list;
    }

    public int updateProductinfo(int id, String definition, String customer) {
        int count = productDao.updateProductinfo(id,definition,customer);
        return count;
    }


}
